import {request} from "../../util/api";

export default {
  methods: {
    // 是否设置密码
    closeToWin() {
      request({
        url: '/app/base/firstLogin'
      }).then(ret => {
        if (ret.data) {
          this.$u.route({
            url: 'package/login/new_set_password',
            type: 'reLaunch'
          })
        } else {
          this.firstDataInput();
        }
      })
    },

    // 是否录入基本信息
    firstDataInput() {
      request({
        url: '/app/base/firstDataInput'
      }).then(ret => {
        if (ret.data) {
          this.$u.route({
            url: 'package/login/infomation_entry',
            type: 'reLaunch'
          })
        } else {
          this.backUrl = this.backUrl.replace(/#/g, '?').replace(/@/g, '&').replace(/\*/g, '=')
          if (this.backUrl) {
            this.$u.route({
              url: this.backUrl,
              type: 'reLaunch'
            })
          } else {
            this.$u.route({
              url: '/pages/index/index',
              type: 'switchTab'
            })
          }
        }
      })
    }
  }
}
